package Com.javaserver.dao;

import Com.javaserver.bean.rewland;
import Com.javaserver.utils.DB;

import java.util.List;

public class rewlandserver {
    //奖惩添加
    public rewland rewlandadd(rewland rew){
        int i= DB.executeUpdate("insert into rewland (P_theme,P_type,P_money,P_time,P_reason) values (?, ?, ?, ?, ?)",rew.getP_theme(),rew.getP_type(),rew.getP_money(),rew.getP_time(),rew.getP_reason());
        if (i == -1 ){
            return null;
        }
        return rew;
    }

    //奖惩查询
    public List rewlist(Integer page){
       List list=DB.executeQuery("select * from rewland limit ?, 10", (page - 1) * 10);
       return  list;
    }

    //奖惩删除
    public boolean rewdele(rewland rew){
        String sql="delete from rewland where P_id=?";
        int i=DB.executeUpdate(sql,rew.getP_id());
        return  1>0;
    }

}
